﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CtrlMonthDepartment2.ascx.cs" Inherits="Thksoft.UserCotrols.CtrlMonthDepartment2" %>

<style>
    .mytrclass {
        text-align: center;
    }

        .mytrclass:nth-child(odd) {
            background-color: rgb(234, 255, 255);
        }

        .mytrclass:hover {
            background-color: #d5e7ff;
            cursor: pointer;
        }

        .mytrclass td.left {
            text-align: left;
            text-indent: 10px;
        }
</style>

<table class="table" border="0" width="100%" cellpadding="0" cellspacing="0">
    <asp:Button CssClass="hide" runat="server" ID="ReLoadBtn" OnClick="ReLoadBtn_Click" />
    <tr style="font-size: 24px; background-color: #8BC4E1;">
        <th style="border: 1px solid #BAD4E1;">填报人</th>
        <th style="border: 1px solid #BAD4E1;">部门</th>
        <th style="border: 1px solid #BAD4E1;">流入金额</th>
        <th style="border: 1px solid #BAD4E1;">流出金额</th>
        <th style="border: 1px solid #BAD4E1;">详情</th>
    </tr>
    <%
        var appStr = "window." + this.ClientID;
        foreach (var item in this.Model)
        {
    %>
    <tr class="mytrclass">
        <td><%=item["UserName"].ToString() %></td>
        <td><%=item["DepartmentName"].ToString() %></td>
        <td><%=item["InMoney"].ToObject<decimal>().ToString("0.0000") %></td>
        <td><%=item["OutMoney"].ToObject<decimal>().ToString("0.0000") %></td>
        <td><a onclick="<%=appStr+".SelectClick("+item["UserId"].ToObject<int>()+")" %>" style="color: blue;">查看详情</a></td>
    </tr>
    <%
        }
    %>
</table>
<script src="/Scripts/jquery.1.11.1.js"></script>
<script>
    !function () {
        var key = "<%=this.ClientID%>";
        var reLoadBtn = "<%=this.ReLoadBtn.ClientID %>";
        window[key] = {};
        var app = window[key];
        //编辑事件
        app.SelectClick = function (userId) {
            //直接调用Layer
            var option = {};
            option.type = 2;
            option.content = ["/Module/ApplyView/Apply/Select/MonthDepartmentCk.aspx?ApplyId=<%=this.ApplyId%>&UserId=" + userId + "&Type=MonthDepartmentCk", "no"];
            option.title = "资金计划";
            option.area = ["800px", "600px"];
            option.end = function () {
                app.Reload();
            };
            top.layer.open(option);
        };
        //刷新页面事件
        app.Reload = function () {
            $("#"+reLoadBtn).click();
        };
    }();
</script>